package com.guandi.geekbrowser.primary.service.impl;

import com.guandi.geekbrowser.primary.entity.Task;
import com.guandi.geekbrowser.primary.repository.TaskRepository;
import com.guandi.geekbrowser.primary.service.TaskService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TaskImpl implements TaskService {

    @Autowired
    private TaskRepository taskRepository;

    @Override
    public Task findByNameAndUserId(String name, String userId) {
        return taskRepository.findByNameAndUserId(name, userId);
    }

    @Override
    public void save(Task task) {
        taskRepository.save(task);
    }

    @Override
    public List<Task> findByNameAndUserIdAndType(String name, String userId, Integer type) {
        return taskRepository.findByNameAndUserIdAndType(name, userId, type);
    }

    @Override
    public List<Task> findByUserIdAndType(String userId, Integer type) {
        return taskRepository.findByUserIdAndType(userId, type);
    }

    @Override
    public List<Task> findByUserIdAndTypeAndCountry(String userId, Integer type, String country) {
        return taskRepository.findByUserIdAndTypeAndCountry(userId, type, country);
    }


}
